﻿// ParseLib - An open source library for natural language processing.
// Copyright (C) Kais Dukes, 2012. E-mail: kais@kaisdukes.com
// http://parselib.org

namespace ParseLib.Tagging.Brill.Rules
{
    public abstract class Rule
    {
        public RuleType RuleType { get; set; }

        public PartOfSpeech From { get; set; }

        public PartOfSpeech To { get; set; }

        public abstract bool Match(Sentence sentence, int index);

        public abstract void Apply(Sentence sentence);

        public static string FormatRuleType(RuleType type)
        {
            switch (type)
            {
                case RuleType.Previous:
                    return "the previous tag";
                case RuleType.TwoBefore:
                    return "the tag two before";
                case RuleType.OneOfPreviousTwo:
                    return "one of the previous two tags";
                case RuleType.OneOfPreviousThree:
                    return "one of the previous three tags";
                case RuleType.Next:
                    return "the next tag";
                case RuleType.TwoAfter:
                    return "the tag two after";
                case RuleType.OneOfNextTwo:
                    return "one of the next two tags";
                case RuleType.OneOfNextThree:
                    return "one of the next three tags";
                default:
                    return null;
            }
        }
    }
}